import pygame
from pygame.locals import *
from Handler import *

def main():
	distance = 20 # distance from penalty mark to goal
	
	pygame.init()
	window = pygame.display.set_mode(pygame.image.load('stadium.gif').get_size())
	pygame.display.set_caption("Pellegrino's 2nd Bimester")
	screen = pygame.display.get_surface()
	
	handler = Handler(screen, distance)
	
	while True:
		events = pygame.event.get()
		for event in events:
			if event.type == QUIT:
				exit(0)
			elif event.type == MOUSEBUTTONUP:
				handler.play(event.pos, screen)
				handler.restart(screen)
				pygame.event.clear()
				break
		if not events:
			handler.wait()
			
	
if __name__ == "__main__":
	main()
